package com.xlh.param.course;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xlh.constant.UserConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import java.time.LocalDateTime;

/**
 * 文件参数
 * <p>
 * Created by lx on 2019/4/12.
 */
@Data
public class FileParam {

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "文件名称")
    @NotBlank(message = "文件名称不能为空")
    private String fileName;

    @JsonIgnore
    @ApiModelProperty(value = "下载文件名")
    private String downloadFileName;

    @JsonIgnore
    @ApiModelProperty(value = "过期时间")
    private LocalDateTime expireTime = LocalDateTime.now().plusSeconds(UserConstant.CODE_EXPIRED_TIME);

    public boolean isExpired() {
        return LocalDateTime.now().isAfter(expireTime);
    }

}
